package com.bdqn.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * ConfigManager
 *
 * @author LILIBO
 * @since 2022-06-15
 */
public class ConfigManager {

    // 定义配置文件位置
    private static String config = "database.properties";

    /**
     * Properties 配置文件对象
     */
    private static Properties properties = new Properties();

    /**
     * 加载配置文件
     */
    static {
        InputStream input = ConfigManager.class.getClassLoader().getResourceAsStream(config);
        try {
            properties.load(input);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 通过Key获取配置文件Value
     *
     * @param key Key
     * @return Value
     */
    public static String getProperty(String key) {
        return properties.getProperty(key);
    }

}
